package com.handa.admin.userservice.websocket.Enums;


public enum WebChatDataTypeEnum {
    SYSTEM_USER_ONLINE_MESSAGE("用户上线 发送消息", 0),
    SYSTEM_BROADCAST_MESSAGE("系统广播 系统时间 消息", 1),

    WEB_CHAT_USER_TEXT_MESSAGE("webChat 用户 发送文本消息", 100),
    WEB_CHAT_SERVER_FORWARD_TEXT_MESSAGE("webChat 服务器转发文本 消息", 101),
    WEB_CHAT_USER_IMAGE_MESSAGE("webChat 用户 发送图片消息", 102),
    WEB_CHAT_USER_FILE_MESSAGE("webChat 用户 发送文件消息", 103);

    public final int code;
    public final String desc;

    WebChatDataTypeEnum(String desc, int code) {
        this.desc = desc;
        this.code = code;
    }

    // 根据 code 获取枚举实例
    public static WebChatDataTypeEnum getByCode(int code) {
        for (WebChatDataTypeEnum type : values()) {
            if (type.code == code) {
                return type;
            }
        }
        return null;
    }
}